package hander

import (
	"github.com/gin-gonic/gin"
	"good/api/reponse"
	"good/api/request"
	"good/internal/dao"
	"good/internal/models"
	"gorm.io/gorm"
)

func MessageDel(c *gin.Context) {
	req := request.MessageDel{}
	if err := c.ShouldBind(&req); err != nil {
		reponse.ErrorRequest(c, "绑定失败")
		return
	}
	user := models.Message{
		Model: gorm.Model{ID: uint(req.Id)},
	}
	if err := dao.MessageList(&user); err != nil {
		reponse.ErrorRequest(c, "消息过期清理失败")
		return
	}
	reponse.SuccessRequest(c, "消息过期清理成功", user.ID)
}
